package mybox.engine.rundfeder;

import mybox.engine.Figur;
import mybox.engine.File4Qcad;
import mybox.engine.Line;
import mybox.engine.QVector;

public class Ausnehmung implements Figur{

	public boolean isToTheRight;
	public double breite;
	public double tiefe;
	Line line;
	public Line[] ausArr = new Line[3];
	
	public static boolean TO_RIGHT=true;
	
	public Ausnehmung(File4Qcad file4qcad, Line line, boolean isToTheRight, double tiefe) {
		this.line=line;
		this.isToTheRight=isToTheRight;		
		this.breite=line.length();
		this.tiefe=tiefe;//
		
		QVector lineVector = QVector.diff(line.end, line.begin);
		
		QVector lineZurSeite=null;
		
		if (isToTheRight) lineZurSeite = lineVector.ortho2Rechts().normiereAuf(tiefe);
		else              lineZurSeite = lineVector.ortho2Links().normiereAuf(tiefe);
		
		QVector currBegin = line.begin;
		QVector currEnd = line.begin.vecAdd(lineZurSeite);		
		ausArr[0]=new Line(file4qcad, new QVector(currBegin), new QVector(currEnd));
		
		currBegin=currEnd;
		currEnd=new QVector(currEnd.vecAdd(lineVector));
		ausArr[1]=new Line(file4qcad, new QVector(currBegin), new QVector(currEnd));
		
		currBegin=currEnd;
		currEnd=line.end;
		ausArr[2]=new Line(file4qcad, new QVector(currBegin), new QVector(currEnd));
		
	}
	
	@Override
	public void draw() {
		for (Line line : ausArr) line.draw();
	}
	
}
